﻿Imports TwitterVB2
Imports System.IO.File
Public Class frmFollowers
    'this form is linked with the top menu. DO NOT GET CONFUSED WITH THE OTHER FORM!
    Public tw As New TwitterAPI
    Dim consumer As String = "3rZoMe2v9ZDq5T1JoyVzyw"
    Dim consumersecret As String = "Za0raOo0mDs0xqgmmGxS1YI7hxUdoPmBnGtfFVHBek"
    Public oauthtoken As String
    Public oauthtokensecret As String
    Dim tempList As New ListBox
    Public lstFollowerCache As New ListBox
    Dim followernum As Integer = 0
    Dim Followers As New Windows.Forms.ComboBox
    Dim oFile As System.IO.File
    Dim oWrite As System.IO.StreamWriter

    Private Sub frmFollowers_Disposed(sender As Object, e As System.EventArgs) Handles Me.Disposed

        Dim i As Integer

        oWrite = IO.File.CreateText(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat")

        For i = 0 To lstFollowerCache.Items.Count - 1

            oWrite.WriteLine(lstFollowerCache.Items.Item(i))

        Next

        oWrite.Close()

    End Sub

    Private Sub frmFollowers_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

        Dim i As Integer

        oWrite = IO.File.CreateText(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat")

        For i = 0 To lstFollowerCache.Items.Count - 1

            oWrite.WriteLine(lstFollowerCache.Items.Item(i))

        Next

        oWrite.Close()

    End Sub

    Private Sub frmFollowers_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

        If e.CloseReason = CloseReason.UserClosing Then
            'Don't close permanently so we don't lose any information we need until the end.
            e.Cancel = True
            Me.Hide()
        End If

    End Sub

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'On Error Resume Next
        'Dim objReader As New System.IO.StreamReader(Application.StartupPath & "\" & frmLogin.txtUsername.Text & "_OAuthtk.dat")
        ' My.Settings.m_strToken = objReader.ReadLine()
        ' My.Settings.Save()

        'objReader.Close()

        ' Dim objReader1 As New System.IO.StreamReader(Application.StartupPath & "\" & frmLogin.txtUsername.Text & "_OAuthtkST.dat")
        'My.Settings.m_strTokenSecret = objReader1.ReadLine()
        'My.Settings.Save()

        'objReader1.Close()

        Me.Width = 386

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        lstFollowers.Items.Clear()

        If IO.File.Exists(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat") Then

            Button3.Enabled = False

            Dim i As Integer

            For i = 0 To lstFollowerCache.Items.Count - 1

                lstFollowers.Items.Add(lstFollowerCache.Items.Item(i))

            Next

        Else

            For Each twUser As TwitterUser In tw.Followers

                lstFollowers.Items.Add(twUser.ScreenName & "," & twUser.ID)

            Next

            Button3.Enabled = True
            Button3.PerformClick()
            btnUpdateUnfollowers.Enabled = False

        End If

        ToolTip2.SetToolTip(btnUpdateUnfollowers, "Update your 'Unfollower List'!")
        'tmrFollowCheck.Enabled = True
        followernum = 0

        lblStatus.Text = My.Settings.followerUpdate
        lblFollowBack.Text = My.Settings.followingUpdate

        frmLoading.Hide()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        '  Form1.TextBox2.Text = Form1.TextBox2.Text & " @" & lstFollowers.Text

        Dim i As Integer

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        Dim theUser = Split(lstFollowers.Text, ",")
        Dim twUser As TwitterUser = tw.ShowUser(theUser(0))
        Dim theID As Long = theUser(1)

        lblFollowers.Text = twUser.FollowersCount
        lblFollowing.Text = twUser.FriendsCount
        lblTotalTweets.Text = twUser.StatusesCount
        lblVerified.Text = twUser.Verified
        lblFollowingMe.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.FollowedBy
        lblYoureFollowing.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.Following
        txtStatus.Text = twUser.Status.Text

        GroupBox2.Text = theUser(0) & "'s Mini Profile"

        If lblYoureFollowing.Text = "True" Then

            btnProfileFollow.Text = "Unfollow User"

        Else

            btnProfileFollow.Text = "Follow User"

        End If

        For i = Me.Width To 559 Step 5

            Me.Width = i

        Next

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Hide()
    End Sub

    Private Sub lstFollowers_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstFollowers.SelectedIndexChanged

        On Error Resume Next

        If lstFollowers.Text = "" Then
            Button2.Enabled = False
        Else
            Button2.Enabled = True
        End If


        'tw.ShowUser(ComboBox1.Items(ComboBox1.Text))
        If lstFollowers.Text = TextBox1.Text Then

            Exit Sub

        Else

            TextBox1.Text = lstFollowers.Text
            Dim theUser = Split(lstFollowers.Text, ",")
            Dim theID As Long = theUser(1)
            Dim twUser As TwitterUser = tw.ShowUser(theUser(0))

            Button2.Text = "Visit " & theUser(0) & "'s Mini Profile"
            Me.PictureBox1.ImageLocation = twUser.ProfileImageUrl

            lblFollowers.Text = twUser.FollowersCount
            lblFollowing.Text = twUser.FriendsCount
            lblTotalTweets.Text = twUser.StatusesCount
            lblVerified.Text = twUser.Verified
            lblFollowingMe.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.FollowedBy
            lblYoureFollowing.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.Following
            txtStatus.Text = twUser.Status.Text

            If lblYoureFollowing.Text = "True" Then

                btnProfileFollow.Text = "Unfollow User"

            Else

                btnProfileFollow.Text = "Follow User"

            End If

            GroupBox2.Text = theUser(0) & "'s Mini Profile"

            For i = Me.Width To 559 Step 5

                Me.Width = i

            Next

        End If


    End Sub
    Private Sub lstFollowers_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        ToolTip1.SetToolTip(PictureBox1, lstFollowers.Text)
    End Sub

    Private Sub tmrFollowCheck_Tick(sender As System.Object, e As System.EventArgs) Handles tmrFollowCheck.Tick

        On Error Resume Next

        Dim strData = Split(lstFollowers.Items.Item(followernum), ",")

        Dim follower_name = strData(0)
        Dim follower_id = strData(1)


        web.Navigate("http://twitter.com/" + follower_name)

        If web.DocumentText.Contains("Send a Direct Message") Then

            'good

        Else

            lstNotFollowing.Items.Add(lstFollowers.Items.Item(followernum))

        End If

        If (followernum + 1 = lstFollowers.Items.Count) Then

            tmrFollowCheck.Enabled = False
            lblNotFollowing.Text = lstNotFollowing.Items.Count

        Else

            tmrFollowCheck.Enabled = False
            followernum = followernum + 1
            lblNotFollowing.Text = lstNotFollowing.Items.Count

        End If

    End Sub

    Private Sub web_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles web.DocumentCompleted

        On Error Resume Next

        'If InStr("Twitter", web.DocumentText) Then
        tmrFollowCheck.Enabled = True
        'End If

    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

        Dim i As Integer

        If IO.File.Exists(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat").Equals(False) Then

            oWrite = IO.File.CreateText(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat")

            For i = 0 To lstFollowers.Items.Count - 1

                oWrite.WriteLine(lstFollowers.Items.Item(i))
                lstFollowerCache.Items.Add(lstFollowers.Items.Item(i))

            Next

            oWrite.Close()

            Button3.Enabled = False

        End If

        btnUpdateUnfollowers.Enabled = True

    End Sub


    Private Sub chkAutoCheckUnfollow_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAutoCheckUnfollow.CheckedChanged

        If chkAutoCheckUnfollow.Checked Then

            tmrUnfollowCheck.Enabled = True
            MsgBox("Smart Promoter will now check for unfollowers at the interval you set.")

        Else

            tmrUnfollowCheck.Enabled = False

        End If

    End Sub

    Private Sub btnUpdateUnfollowers_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdateUnfollowers.Click

        On Error Resume Next

        If btnUpdateUnfollowers.Text = "Check/Update" Then

            frmLoading.Show()
            tmrUpdate.Enabled = True

        Else

            MsgBox("You must wait at least 60 seconds before trying this again to avoid being blocked by Twitter.")

        End If

    End Sub

    Private Sub tmrUnfollowCheck_Tick(sender As System.Object, e As System.EventArgs) Handles tmrUnfollowCheck.Tick

        On Error Resume Next

        If chkAutoCheckUnfollow.Checked = True Then

            If tmrBtnUpdate.Enabled = True Then

                btnUpdateUnfollowers.Text = "Check/Update"
                ToolTip2.SetToolTip(btnUpdateUnfollowers, "Update your 'Unfollower List'!")
                btnUpdateUnfollowers.Enabled = True
                tmrBtnUpdate.Enabled = False

            End If

            Call btnUpdateUnfollowers.PerformClick()

        End If

    End Sub

    Private Sub tmrBtnUpdate_Tick(sender As System.Object, e As System.EventArgs) Handles tmrBtnUpdate.Tick

        btnUpdateUnfollowers.Text = "Check/Update"
        ToolTip2.SetToolTip(btnUpdateUnfollowers, "Update your 'Unfollower List'!")
        btnUpdateUnfollowers.Enabled = True
        tmrBtnUpdate.Enabled = False

    End Sub

    Private Sub txtInterval_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtInterval.TextChanged

        If txtInterval.Text > 0 Then

            tmrUnfollowCheck.Interval = txtInterval.Text * 60000

        End If

    End Sub

    Private Sub frmFollowers_Resize(sender As Object, e As System.EventArgs) Handles Me.Resize

        If Me.WindowState = FormWindowState.Minimized Then

            Me.Visible = False

        End If

    End Sub

    Private Sub tmrUpdate_Tick(sender As System.Object, e As System.EventArgs) Handles tmrUpdate.Tick

        tmrUpdate.Enabled = False
        btnUpdateUnfollowers.Text = "Updating..."
        btnUpdateUnfollowers.Enabled = False

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        Dim i As Integer
        Dim tempList As New ListBox
        Dim unfollowed As Integer = 0

        For Each twUser As TwitterUser In tw.Followers

            tempList.Items.Add(twUser.ScreenName & "," & twUser.ID)

        Next

        For i = 0 To lstFollowerCache.Items.Count - 1

            Dim strData = Split(lstFollowerCache.Items.Item(i), ",")

            Dim follower_name = strData(0)
            Dim follower_id = strData(1)

            If (tempList.Items.Contains(lstFollowerCache.Items.Item(i))) Then

                'stillfollowing

            Else

                If chkAutoUnfollow.Checked = False Then

                    lstUnfollowers.Items.Add(lstFollowerCache.Items.Item(i))

                Else

                    Try

                        tw.UnFollow(follower_id)
                        unfollowed = unfollowed + 1

                    Catch ex As Exception

                    End Try

                End If

            End If

        Next

        IO.File.Delete(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat")

        oWrite = IO.File.CreateText(Application.StartupPath & "\" & tw.AccountInformation.ScreenName.ToLower & "_follower-cache.dat")

        For i = 0 To tempList.Items.Count - 1

            oWrite.WriteLine(tempList.Items.Item(i))

        Next

        oWrite.Close()

        lblUnfollow.Text = lstUnfollowers.Items.Count
        btnUpdateUnfollowers.Text = "Updated!"
        btnUpdateUnfollowers.Enabled = True
        lblStatus.Text = "Updated on: " & TimeOfDay
        ToolTip2.SetToolTip(btnUpdateUnfollowers, "You've recently updated. You have to wait 60 seconds to prevent Twitter from blocking you from making requests.")
        tmrBtnUpdate.Enabled = True
        frmLoading.Hide()

        If chkAutoUnfollow.Checked = True And chkAutoFBCheck.Checked = False Then

            MsgBox("Smart Promoter automatically successfully unfollowed " & unfollowed & " people!")

        End If

        If chkAutoFBCheck.Checked = True And chkAutoUnfollow.Checked = True Then

            lstNotFollowing.Items.Add(TimeOfDay & "Smart Promoter automatically successfully unfollowed " & unfollowed & " people!")

        End If

    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        On Error Resume Next

        Dim i As Integer

        For i = 0 To lstUnfollowers.Items.Count - 1

            If lstUnfollowers.GetItemChecked(i) = True Then

                Dim strData = Split(lstUnfollowers.Items.Item(i), ",")

                Dim unfollower_name = strData(0)
                Dim unfollower_id = strData(1)

                tw.UnFollow(unfollower_id)

                lstUnfollowers.Items.Item(i) = "√ Unfollowed " & unfollower_name

            End If

        Next

    End Sub

    Private Sub btnFollowBack_Click(sender As System.Object, e As System.EventArgs) Handles btnFollowBack.Click

        frmLoading.Show()
        frmLoading.Focus()
        btnFollowBack.Enabled = False

        'tmrFollowBack.Enabled = True
        BackgroundWorker1.RunWorkerAsync()

    End Sub

    Private Sub chkAutoUnfollow_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAutoUnfollow.CheckedChanged

        My.Settings.chkAutoUnfollow = chkAutoUnfollow.Checked

    End Sub

    Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Dim theUser = Split(lstFollowers.Text, ",")
        System.Diagnostics.Process.Start("http://twitter.com/" + theUser(0))

    End Sub

    Private Sub PictureBox2_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox2.Click

        Me.Width = 386

    End Sub

    Private Sub Label14_Click(sender As System.Object, e As System.EventArgs) Handles Label14.Click

        Me.Width = 386

    End Sub

    Private Sub btnProfileFollow_Click(sender As System.Object, e As System.EventArgs) Handles btnProfileFollow.Click

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        Dim theUser = Split(lstFollowers.Text, ",")
        Dim theID As Long = theUser(1)
        Dim twUser As TwitterUser = tw.ShowUser(theUser(0))

        If btnProfileFollow.Text = "Unfollow User" Then

            tw.UnFollow(theID)
            Button2.PerformClick()

        Else

            tw.Follow(theID)
            Button2.PerformClick()

        End If

    End Sub

    Private Sub lstUnfollowers_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstUnfollowers.SelectedIndexChanged

        On Error Resume Next

        If lstUnfollowers.Text = "" Then
            Button2.Enabled = False
        Else
            Button2.Enabled = True
        End If


        'tw.ShowUser(ComboBox1.Items(ComboBox1.Text))
        If lstUnfollowers.Text = TextBox1.Text Then
            Exit Sub
        Else
            TextBox1.Text = lstUnfollowers.Text
            Dim theUser = Split(lstUnfollowers.Text, ",")
            Dim theID As Long = theUser(1)
            Dim twUser As TwitterUser = tw.ShowUser(theUser(0))

            Button2.Text = "Visit " & theUser(0) & "'s Mini Profile"
            Me.PictureBox1.ImageLocation = twUser.ProfileImageUrl

            lblFollowers.Text = twUser.FollowersCount
            lblFollowing.Text = twUser.FriendsCount
            lblTotalTweets.Text = twUser.StatusesCount
            lblVerified.Text = twUser.Verified
            lblFollowingMe.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.FollowedBy
            lblYoureFollowing.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.Following
            txtStatus.Text = twUser.Status.Text

            If lblYoureFollowing.Text = "True" Then

                btnProfileFollow.Text = "Unfollow User"

            Else

                btnProfileFollow.Text = "Follow User"

            End If

            GroupBox2.Text = theUser(0) & "'s Mini Profile"

            For i = Me.Width To 559 Step 5

                Me.Width = i

            Next

        End If

    End Sub

    Private Sub lstNotFollowing_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstNotFollowing.SelectedIndexChanged

        On Error Resume Next

        If lstNotFollowing.Text = "" Then
            Button2.Enabled = False
        Else
            Button2.Enabled = True
        End If


        'tw.ShowUser(ComboBox1.Items(ComboBox1.Text))
        If lstNotFollowing.Text = TextBox1.Text Then
            Exit Sub
        Else
            TextBox1.Text = lstNotFollowing.Text
            Dim theUser = Split(lstNotFollowing.Text, ",")
            Dim theID As Long = theUser(1)
            Dim twUser As TwitterUser = tw.ShowUser(theUser(0))

            Button2.Text = "Visit " & theUser(0) & "'s Mini Profile"
            Me.PictureBox1.ImageLocation = twUser.ProfileImageUrl

            lblFollowers.Text = twUser.FollowersCount
            lblFollowing.Text = twUser.FriendsCount
            lblTotalTweets.Text = twUser.StatusesCount
            lblVerified.Text = twUser.Verified
            lblFollowingMe.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.FollowedBy
            lblYoureFollowing.Text = tw.Relationship(theID, tw.AccountInformation.ID).Target.Following
            txtStatus.Text = twUser.Status.Text

            If lblYoureFollowing.Text = "True" Then

                btnProfileFollow.Text = "Unfollow User"

            Else

                btnProfileFollow.Text = "Follow User"

            End If

            GroupBox2.Text = theUser(0) & "'s Mini Profile"

            For i = Me.Width To 559 Step 5

                Me.Width = i

            Next

        End If

    End Sub

    Private Sub chkAutoFlwBack_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAutoFlwBack.CheckedChanged

        My.Settings.chkAutoFlwBack = chkAutoFlwBack.Checked

    End Sub

    Private Sub lblFollowBack_TextChanged(sender As Object, e As System.EventArgs) Handles lblFollowBack.TextChanged

        My.Settings.followingUpdate = lblFollowBack.Text

    End Sub

    Private Sub lblStatus_TextChanged(sender As Object, e As System.EventArgs) Handles lblStatus.TextChanged

        My.Settings.followerUpdate = lblStatus.Text

    End Sub

    Private Sub tmrFollowBack_Tick(sender As System.Object, e As System.EventArgs) Handles tmrFollowBack.Tick

        On Error Resume Next

        tmrFollowBack.Enabled = False
        
        BackgroundWorker1.RunWorkerAsync()

    End Sub

    Private Sub btnFollowChecked_Click(sender As System.Object, e As System.EventArgs) Handles btnFollowChecked.Click

        On Error Resume Next

        btnFollowChecked.Enabled = False

        Dim i As Integer
        Dim followed As New ListBox


        For i = 0 To lstNotFollowing.Items.Count - 1

            Dim theUser = Split(lstNotFollowing.Items.Item(i), ",")
            Dim theID As Long = theUser(1)

            If lstNotFollowing.GetItemChecked(i) = True Then

                tw.Follow(theID)
                lstNotFollowing.Items.RemoveAt(i)
                followed.Items.Add(theUser)

            End If

        Next


        'Dim newFriendCount = tw.AccountInformation.FriendsCount.ToString - frmMain.lblFollowing.Text
        Dim newFriendCount = followed.Items.Count

        MsgBox("Smart Promoter automatically successully followed " & newFriendCount & " people!")

        lblFollowBack.Text = "Updated on: " & TimeOfDay
        btnFollowChecked.Enabled = True

    End Sub

    Private Sub tmrFollowBackCheck_Tick(sender As System.Object, e As System.EventArgs) Handles tmrFollowBackCheck.Tick

        On Error Resume Next

        Dim i As Integer
        Dim tempList As New ListBox
        Dim followed As New ListBox

        For Each twUser As TwitterUser In tw.Friends

            tempList.Items.Add(twUser.ScreenName & "," & twUser.ID)

        Next

        For i = 0 To lstFollowers.Items.Count - 1


            Dim theUser = Split(lstFollowers.Items.Item(i), ",")
            Dim theID As Long = theUser(1)

            Dim imFollowing = tempList.Items.Contains(lstFollowers.Items.Item(i))

            If imFollowing = False Then

                If chkAutoFlwBack.Checked = True Then

                    tw.Follow(theID)
                    followed.Items.Add(theUser)

                Else

                    lstNotFollowing.Items.Add(lstFollowers.Items.Item(i), True)

                End If



            End If

        Next

        If chkAutoFlwBack.Checked = True Then

            'Dim newFriendCount = tw.AccountInformation.FriendsCount.ToString - frmMain.lblFollowing.Text
            Dim newFriendCount = followed.Items.Count

            If chkAutoFBCheck.Checked = False Then

                MsgBox("Smart Promoter automatically successully followed " & newFriendCount & " people!")

            Else

                lstNotFollowing.Items.Add("Smart Promoter automatically successully followed " & newFriendCount & " people!")

            End If

        End If


            lblFollowBack.Text = "Updated on: " & TimeOfDay

            btnFollowBack.Enabled = True

    End Sub

    Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

        Dim i As Integer
        'Dim tempList As New ListBox
        Dim followed As New ListBox

        tw.AuthenticateWith(consumer, consumersecret, My.Settings.m_strToken, My.Settings.m_strTokenSecret)

        For Each twUser As TwitterUser In tw.Friends

            tempList.Items.Add(twUser.ScreenName & "," & twUser.ID)

        Next

        For i = 0 To lstFollowers.Items.Count - 1


            Dim theUser = Split(lstFollowers.Items.Item(i), ",")
            Dim theID As Long = theUser(1)

            Dim imFollowing = tempList.Items.Contains(lstFollowers.Items.Item(i))

            If imFollowing = False Then

                If chkAutoFlwBack.Checked = True Then

                    Try

                        tw.Follow(theID)
                        followed.Items.Add(theUser)

                    Catch ex As Exception

                        'ex.Message

                    End Try

                Else

                    lstNotFollowing.Items.Add(lstFollowers.Items.Item(i), True)

                End If



            End If

        Next

        If chkAutoFlwBack.Checked = True Then

            'Dim newFriendCount = tw.AccountInformation.FriendsCount.ToString - frmMain.lblFollowing.Text
            Dim newFriendCount = followed.Items.Count

            If newFriendCount = 1 Then

                MsgBox("Smart Promoter automatically successully followed " & newFriendCount & " person!")

            ElseIf newFriendCount > 1 Then

                MsgBox("Smart Promoter automatically successully followed " & newFriendCount & " people!")

            End If



        End If

        lstFollowerCache.Items.Clear()

        For i = 0 To tempList.Items.Count - 1

            lstFollowerCache.Items.Add(tempList.Items.Item(i))

        Next

        'tmrUpdated.Enabled = True

        'BackgroundWorker1.CancelAsync()


    End Sub

    Private Sub tmrUpdated_Tick(sender As System.Object, e As System.EventArgs) Handles tmrUpdated.Tick

        tmrUpdate.Enabled = False
        lblFollowBack.Text = "Updated on: " & TimeOfDay

        btnFollowBack.Enabled = True



        frmLoading.Hide()

    End Sub

    Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted

        tempList.Items.Clear()
        lstFollowers.Items.Clear()

        'Dim i As Integer

        lstFollowers.Items.AddRange(lstFollowerCache.Items)

        'For i = 0 To lstFollowerCache.Items.Count - 1

        'lstFollowers.Items.Add(lstFollowerCache.Items.Item(i))

        'Next

        lblFollowBack.Text = "Updated on: " & TimeOfDay

        btnFollowBack.Enabled = True

        frmLoading.Hide()

    End Sub

    Private Sub lblFollowBack_Click(sender As System.Object, e As System.EventArgs) Handles lblFollowBack.Click

    End Sub

    Private Sub lblStatus_Click(sender As System.Object, e As System.EventArgs) Handles lblStatus.Click

    End Sub
End Class